package com.guijianpan.system.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.guijianpan.framework.context.Context;
import com.guijianpan.framework.controller.BaseController;

@Controller
public class MainController extends BaseController {
	
	@RequestMapping("/main")
	public ModelAndView main() {
		return new ModelAndView("main");
	}
	
	/**
	 * 首页
	 * @return
	 */
	@RequestMapping(value="/home", method={RequestMethod.GET, RequestMethod.POST})
	public ModelAndView home() {
		String hello = "Hello " + Context.getCurrentUser().getName() + "!";
		return new ModelAndView("home/home").addObject("hello", hello);
	}
	
	/**
	 * 没有访问权限页面
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/error/withoutRight", method={RequestMethod.GET, RequestMethod.POST})
	public ModelAndView loginout(HttpServletRequest request) {
		return new ModelAndView("/common/withoutRight");
	}
	
}
